package com.liyiruo.dwb.controller;

import com.liyiruo.dwb.domain.Ebook;
import com.liyiruo.dwb.req.EbookReq;
import com.liyiruo.dwb.resp.CommonResp;
import com.liyiruo.dwb.resp.EbookResp;
import com.liyiruo.dwb.service.EbookService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author liyiruo
 * @Description
 * @Date 2021/12/4 下午12:08
 */
@RestController
@RequestMapping("/ebook")
public class EbookController {
    @Resource
    private EbookService ebookService;

    @RequestMapping("/list")
    public CommonResp list(EbookReq ebookReq) {
        CommonResp<List<EbookResp>> resp = new CommonResp<>();
        List<EbookResp> ebookResps = ebookService.list(ebookReq);
        resp.setContent(ebookResps);
        return resp;
    }
}
